<template>
  <div class="main-header">
    <div class="menu-icon" @click="handleMenuIconClick">
      <!-- <el-icon size="25px" v-if="isActive"><Fold /></el-icon>
      <el-icon size="25px" v-if="!isActive"><Expand /></el-icon> -->
      <el-icon size="25px">
        <component :is="isActive ? 'Expand' : 'Fold'" />
      </el-icon>
    </div>
    <div class="content">
      <header-crumb />
      <headerInfo />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import headerInfo from './c-cpns/header-info.vue'
import headerCrumb from './c-cpns/header-crumb.vue'

// 0. 内部自定义事件
const emit = defineEmits(['foldChange'])

const isActive = ref(false)
function handleMenuIconClick() {
  console.log('handleMenuIconClick')
  // 1. 切换按钮逻辑
  isActive.value = !isActive.value
  // 2. 将改变的事件传递给父组件
  emit('foldChange',isActive.value)
}
</script>

<style scoped lang="less">
.main-header {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  .menu-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
  }
  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 18px;
  }
}
</style>
